<assign name="page_title" value="修改账号" />
<include file="Public:header" />

<div id="main">
    <div id="main-header" class="grid page">
        <h2>爱咕噜</h2>
        <h1>修改账号</h1>
    </div>
    <div id="sub-main-header"></div>
    <div id="main-inner" class="account_edit page">
        <div class="hidden">
            <h3>修改手机</h3>
            <hr class="dash" />
            <div id="account-edit-mobile" class="grid">
                <form action="__URL__/savemobile" method="post">
                    <table class="edit">
                        <tr>
                            <td class="label small" width="30%">手机</td>
                            <td><input class="text" type="text" name="mobilephone" id="mobilephone" value="{{$profile.mobilephone}}"/> <a href="__URL__/saveVerify">发送验证码</a></td>
                        </tr>
                        <tr>
                            <td class="label small"></td>
                            <td><button class="btn btn_silver fbold" type="submit"><span>保存修改</span></button></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <h3>修改邮箱</h3>
        <hr class="dash" />
        <div id="account-edit-email" class="grid">
            <form action="__URL__/saveemail" method="post" class="ajaxform" >
                <table class="edit">
                    <tr>
                        <td class="label small" width="30%">老密码</td>
                        <td><input class="text" type="password" name="password" id="password" required="required" autocomplete="off" value="" /></td>
                    </tr>
                    <tr>
                        <td class="label small">新邮箱</td>
                        <td><input class="text" type="email" name="email" id="email" required="required" /></td>
                    </tr>
                    <tr>
                        <td class="label small">确认邮箱</td>
                        <td><input class="text" type="email" name="reemail" data-equals="email" id="reemail" /></td>
                    </tr>
                    <tr>
                        <td class="label small"></td>
                        <td><button class="btn btn_silver fbold" type="submit"><span>保存修改</span></button></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script>
    Do("validator",function(){
        $("form.ajaxform").validator().submit(function(e){
            var form = $(this);
            if (!e.isDefaultPrevented()) {
                Cute.api.post(form.attr("action"),form.serializeArray(), function(json){
                    if(json.status > 0){
                        new Cute.ui.dialog().suggest(json.info);
                    }else{
                        form.data("validator").invalidate(json.info);
                    }
                });
                e.preventDefault();
            }
        });
    });
</script>
<include file="Public:footer" />
